//the global variable which used to store all the page modules
var contentPanels = [];

dojo.require("dijit.layout.TabContainer");
dojo.require("dijit.layout.ContentPane");
/**
 * used to init and show the dojo tab.
 */
function loadContentPanels() {
	var tabContainer = new dijit.layout.TabContainer({style:"width:100%;height:100%"},
		"tab_container"
	);
	
	for(var i = 0;i<contentPanels.length;i++){
		tabContainer.addChild(contentPanels[i]);
	}
	tabContainer.startup();
}

function relloadScript(loadedHtmlElements){
	var scripts = loadedHtmlElements.getElementsByTagName("Script");
	var newScripts = [];
	for(var i=scripts.length-1;i>=0;i--){
		var oldScript = scripts[i];
		var newScript = document.createElement("SCRIPT");
		if(oldScript.innerHTML != ""){
			newScript.innerHTML = oldScript.innerHTML;
		}
		if(oldScript.src != ""){
			newScript.src=oldScript.src;
		}
		newScripts[i] = newScript;
		loadedHtmlElements.removeChild(oldScript);
	}
	for(var i=newScripts.length-1;i>=0;i--){
		loadedHtmlElements.appendChild(newScripts[i]);
	}
}
dojo.addOnLoad(loadContentPanels);